import torch
import json

width = 20

input = torch.randn(width)
operator = torch.nn.ReLU()
output = operator.forward(input)

exportData = [
    ('input', input),
    ('output', output)
]

data = []
for name, tensor in exportData:
    data.append({"layer": name, "value": tensor.tolist()})

jsonString = json.dumps(data)
with open('ReluTest.json', 'w') as f:
    f.write(jsonString)
print('TestBench generate finished.')
